package com.thirteenClassics.enumeration;

import lombok.Getter;

@Getter
public enum BanbenTypeEnum {
    CLASSICBAN(1, "经典版"),
    COMPBAN(2, "对照版"),
    ;

    private final long code;
    private final String name;

    BanbenTypeEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public static BanbenTypeEnum getEnum(int code) {
        for (BanbenTypeEnum dataStatusEnum : BanbenTypeEnum.values()) {
            if (code == dataStatusEnum.getCode()) {
                return dataStatusEnum;
            }
        }
        return null;
    }

    public static String getTypeByCode(int code) {
        for (BanbenTypeEnum dataStatusEnum : BanbenTypeEnum.values()) {
            if (code == dataStatusEnum.getCode()) {
                return dataStatusEnum.getName();
            }
        }
        return null;
    }
}
